package com.offcn.controller;

import com.offcn.utils.Result;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: wy
 * @Date: 2022/9/7 16:57
 */
@Controller
@ResponseBody

@RequestMapping("user")
public class UserController {

    //获取名字的方法 ——  在 springSecurity
    @RequestMapping("getUsername")
    public Result getUsername(Authentication authentication){
        String username = authentication.getName();
        return new Result(true,"",username);
    }
}
